package com.region.integral.business_user.query.impl;

import org.springframework.stereotype.Component;

import com.region.integral.business_user.pojo.BUIEntity;
import com.region.integral.business_user.query.IIntegralQuery;
import com.region.integral.exception.IntegralException;
import com.region.integral.hibernate.BaseHibernate;
@Component("business_user_IntegralQuery")
public class IntegralQueryImpl extends BaseHibernate implements IIntegralQuery {

	@Override
	public int getCurrIntegral(int business_userid) {
		int currIntegral = 0;
		try {
			BUIEntity buiEntity = getBUIEntity(business_userid);
			if(buiEntity != null){
				currIntegral = buiEntity.getCurrIntegral();
			}
		} catch (IntegralException e) {
			e.printStackTrace();
		}
		return currIntegral;
	}

	@Override
	public int getMaxIntegral(int business_userid) {
		int maxIntegral = 0;
		try {
			BUIEntity buiEntity = getBUIEntity(business_userid);
			if(buiEntity != null){
				maxIntegral = buiEntity.getMaxIntegral();
			}
		} catch (IntegralException e) {
			e.printStackTrace();
		}
		return maxIntegral;
	}

}
